package com.jwsoft.manager.core.gateway.controller;

import com.jwsoft.manager.core.integration.EduhSocialSecurityIntegration;
import com.jwsoft.manager.common.vo.eduhSocialSecurity.EduhSocialSecurityVO;
import com.jwsoft.manager.common.vo.eduhSocialSecurity.EduhSocialSecurityKeyVO;
import com.jwsoft.manager.common.vo.eduhSocialSecurity.EduhSocialSecurityQueryVO;
import com.github.pagehelper.PageInfo;
import com.bifang.engine.assistant.core.domain.AppResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;
import com.bifang.engine.protect.core.annotation.Idempotent;
import org.springframework.validation.annotation.Validated;
import com.bifang.assistant.common.constants.Validators;

/**
 * 参保记录历史表网关
 *
 * @author zhiyuan
 * @since 2023-09-22
 */
@RestController
@RequestMapping(value = "/doc/api")
@Tag(name = "参保记录历史表", description = "参保记录历史表")
public class EduhSocialSecurityController {

    @Autowired
    public EduhSocialSecurityIntegration eduhSocialSecurityIntegration;

    @Operation(summary = "参保记录历史表分页查询",description = "参保记录历史表分页查询")
    @PostMapping(value = "/eduhSocialSecurity0001", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EduhSocialSecurityVO>> getList(@RequestBody @Validated EduhSocialSecurityQueryVO vo) {
        return AppResponse.successData(eduhSocialSecurityIntegration.getList(vo));
    }

    @Operation(summary = "参保记录历史表根据主键查询详情",description = "参保记录历史表根据主键查询详情")
    @PostMapping(value = "/eduhSocialSecurity0002", produces = "application/json;charset=UTF-8")
    public AppResponse<EduhSocialSecurityVO> getById(@RequestBody @Validated EduhSocialSecurityKeyVO vo) {
        return AppResponse.successData(eduhSocialSecurityIntegration.getById(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "参保记录历史表新增",description = "参保记录历史表新增")
    @PostMapping(value = "/eduhSocialSecurity0004", produces = "application/json;charset=UTF-8")
    public AppResponse<EduhSocialSecurityVO> add(@RequestBody @Validated(value = {Validators.Add.class}) EduhSocialSecurityVO vo) {
        return AppResponse.successData(eduhSocialSecurityIntegration.add(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "参保记录历史表修改",description = "参保记录历史表修改")
    @PostMapping(value = "/eduhSocialSecurity0005", produces = "application/json;charset=UTF-8")
    public AppResponse<EduhSocialSecurityVO> edit(@RequestBody @Validated(value = {Validators.Edit.class}) EduhSocialSecurityVO vo) {
        return AppResponse.successData(eduhSocialSecurityIntegration.edit(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "参保记录历史表删除",description = "参保记录历史表删除")
    @PostMapping(value = "/eduhSocialSecurity0006", produces = "application/json;charset=UTF-8")
    public AppResponse del(@RequestBody @Validated EduhSocialSecurityKeyVO vo) {
        eduhSocialSecurityIntegration.del(vo);
        return AppResponse.successMsg("删除成功！");
    }
}
